<?php


namespace app\api\controller\v1;


use app\api\validate\Count;
use app\api\model\Product as ProductModel;
use app\api\validate\IDMustBePostiveInt;

class Product
{
    public  function getRecent($count=15){
        (new  Count())->goCheck();
        $result = ProductModel::getMostRecent($count);
        return $result;
    }

    public function getAllInCategory($id)
    {
        // 参数验证
        (new IDMustBePostiveInt())->goCheck();
       $result = ProductModel::getProductsByCategoryID($id);
       return $result;
    }

    public function getOne($id){
        (new IDMustBePostiveInt())->goCheck();
        $result = ProductModel::getProductByID($id);
        return $result;
    }



































}

